package com.mgq.juc.c1;

import java.util.concurrent.locks.LockSupport;

/**
 * @author MaGuangQi
 * @description
 * @date 2021-12-16 15:07
 **/
public class TestPark {
    public static void main(String[] args) throws InterruptedException {
        Thread thread = new Thread(()-> {
            System.out.println("park");
            //暂停线程运行
            LockSupport.park();
            System.out.println("resume");
        }, "t1");
        thread.start();

        Thread.sleep(1000);
        System.out.println("unpark");
        //恢复线程运行
        LockSupport.unpark(thread);
    }
}
